package main

import "fmt"

//声明一种行的数据类型 myint， 是int的一个别名
type myInt int

//定义一个结构体
type Book struct {
	title string
	auth  string
}

//副本修改
func changeBook(book Book) {
	//传递一个book的副本
	book.auth = "888"
}

//指针修改
func changeBook2(book *Book) {
	book.auth = "7777"
}

func main() {
	var a myInt = 10
	fmt.Println("a = ", a)
	fmt.Printf("type of a = %T\n", a)

	var book Book

	book.auth = "郑思"
	book.title = "洞穴奇案"
	fmt.Println(book)
	fmt.Printf("%s \n", book)
	fmt.Printf("%v \n", book)
	fmt.Printf("%c \n", book)

	changeBook(book)
	fmt.Printf("%v \n", book)

	changeBook2(&book)
	fmt.Printf("%v \n", book)
}
